package com.demo;

import java.io.*;
import java.sql.*;
import javax.sql.DataSource;
import javax.servlet.*;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.*;
import com.demo.Product;
import java.util.*;
import javax.naming.*;

@WebServlet("/productquery.do")
public class ProductQueryServlet extends HttpServlet {
	  private static final long serialVersionUID = 1L;
	  DataSource dataSource;
	  public void init() {
	    try {
	       Context context = new InitialContext();
	       dataSource = 
(DataSource)context.lookup("java:comp/env/jdbc/sampleDS");
	    }catch(NamingException ne){
	       System.out.println("Exception:"+ne);
	    }
	 }
	 public void doPost(HttpServletRequest request, 
HttpServletResponse response) 
throws ServletException, IOException {
	     Connection dbconn = dataSource.getConnection();
}
	 public void doGet(HttpServletRequest request, 
HttpServletResponse response) 
throws ServletException, IOException {
	     Connection dbconn = dataSource.getConnection();
}
}
